package com.truesai.entities.income;

import java.math.BigDecimal;
import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * 浮动利润总表<br/>
 * 需求分析<br/>
 * <strong>唯一性:</strong>采购入库or销售，操作日期
 * @author XuLian
 *
 */
@Entity
@NamedQueries(
{
        @NamedQuery(name = FloatProfit.ALL, query = "Select fp from FloatProfit fp"),
        @NamedQuery(name = FloatProfit.BY_OPID, query = "Select fp from FloatProfit fp where fp.opId = :opid"),
        @NamedQuery(name = FloatProfit.BY_ID, query = "Select fp from FloatProfit fp where fp.id = :id") })
@Table(name = "FloatProfits")
public class FloatProfit {
	public static final String ALL = "FloatProfit.all";

    public static final String BY_OPID = "FloatProfit.byOpId";

    public static final String BY_ID = "FloatProfit.byId";
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    /**采购入库id or 销售id*/
    @Column
    private Long opId;
    
    /**操作日期*/
    @Column
    private Date opDate;
    
    /**利润*/
    @Column
    private BigDecimal profit;
    
    public FloatProfit() { }
    
    public FloatProfit(Long opId, Date opDate, BigDecimal profit) {
    	this.opId = opId;
    	this.opDate = opDate;
    	this.profit = profit;
    }
    
}
